package com.bw.home.ui

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.bumptech.glide.Glide
import com.bw.home.R
import com.bw.home.databinding.FragmentHomeDetailDescripteBinding
import com.bw.home.entity.SimpleVideoEntity
import com.bw.lib_common.ConstValue
import com.bw.lib_mvi.view.BaseMVIFragment


class HomeDetailDescripteFragment : BaseMVIFragment() {
    lateinit var binding: FragmentHomeDetailDescripteBinding
    lateinit var data: SimpleVideoEntity
    lateinit var homeDetailRecommendFragment: HomeDetailRecommendFragment

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        binding = FragmentHomeDetailDescripteBinding.inflate(inflater, container, false)
        return binding.root
    }

    override fun initData() {
        super.initData()
        data = arguments?.getParcelable(ConstValue.homeDetailData)!!

        binding.homeDetailAutherTv.text = data.name
        Glide.with(this).load(data.avatar_url).into(binding.homeDetailAutherimagIv)
        binding.homeDetailTitleTv.text = data.title

        homeDetailRecommendFragment = HomeDetailRecommendFragment()
        parentFragmentManager.beginTransaction()
            .add(R.id.home_detail_recommend_fl, homeDetailRecommendFragment)
            .commitAllowingStateLoss()
    }

    override fun generateViewModel() {

    }

    override fun handlerState() {

    }

}